<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>委托单管理</title>
	<meta name="decorator" content="ani"/>
	<style>

		#searchresult
		{
			width: 800px;
			position: absolute;
			z-index:1000;
			overflow: hidden;
			left: 140px;
			top: 71px;
			background: #E0E0E0;
			border-top: none;

		}

		.line
		{
			font-size: 15px;
			background: #E0E0E0;
			width: 800px;
			padding:0px;
		}
		.hover
		{
			background: #007ab8;
			width: 800px;
			color: #fff;
		}
		.std
		{
			width: 800px;
		}
		#searchresult1
		{
			width: 260px;
			position: absolute;
			z-index: 1;
			overflow: hidden;
			left: 140px;
			top: 71px;
			background: #E0E0E0;
			border-top: none;

		}

		.line1
		{
			font-size: 15px;
			background: #E0E0E0;
			width: 140px;
			padding:0px;
		}
		.hover1
		{
			background: #007ab8;
			width: 140px;
			color: #fff;
		}
		.std1
		{
			width: 150px;
		}
		#searchresult2
		{
			width: 260px;
			position: absolute;
			z-index: 1;
			overflow: hidden;
			left: 140px;
			top: 71px;
			background: #E0E0E0;
			border-top: none;

		}

		.line2
		{
			font-size: 15px;
			background: #E0E0E0;
			width: 140px;
			padding:0px;
		}
		.hover2
		{
			background: #007ab8;
			width: 140px;
			color: #fff;
		}
		.std2
		{
			width: 150px;
		}
	</style>
	<script type="text/javascript">
        var validateForm;
        var $table; // 父页面table表格id
        var $topIndex;//弹出窗口的 index
        function doSubmit(table, index){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
            if(validateForm.form()){
                $table = table;
                $topIndex = index;
                jp.loading();
                $("#inputForm").submit();
                return true;
            }

            return false;
        }

        $(document).ready(function() {
            var pro=$("#pro").val();
            var mode=$("#mode").val();
            var ty=$("#ty").val();
            var id=$("#id").val();
            var wid=$("#wid").val();
            $.ajax({
                url:'${ctx}/infor/width/findWidth',
                success:function (data) {
                    $("#width").empty();
                    $.each(JSON.parse(data), function (idx, item) {
                        if(wid==item.width){
                            $("#width").append("<option selected='selected' value='"+item.width+"'>"+item.width+"</option>");
                        }else{
                            $("#width").append("<option value='"+item.width+"'>"+item.width+"</option>");
                        }
                    })

                }
            })


            if(pro!=null && pro!=""){
                //结算方式
                $.ajax({
                    url:'${ctx}/infor/project/findSettlementMode',
                    success:function (data) {
                        $("#clearingMode").empty();
                        $.each(JSON.parse(data), function (idx, item) {
                            if(mode==item.mode){
                                $("#clearingMode").append("<option selected='selected'>"+item.mode+"</option>");
                            }else{
                                $("#clearingMode").append("<option>"+item.mode+"</option>");
                            }
                        });
                    }
                })
                //结算类型
                $.ajax({
                    url:'${ctx}/infor/project/findSettlementType',
                    success:function (data) {
                        $("#clearingType").empty();
                        $.each(JSON.parse(data), function (idx, item) {
                            if(ty==item.type){
                                $("#clearingType").append("<option selected='selected'>"+item.type+"</option>");
                            }else{
                                $("#clearingType").append("<option>"+item.type+"</option>");
                            }

                        });
                    }
                })
            }
            validateForm = $("#inputForm").validate({
                submitHandler: function(form){
                    jp.post("${ctx}/tms/planning/save",$('#inputForm').serialize(),function(data){
                        if(data.success){
                            $table.bootstrapTable('refresh');
                            jp.success(data.msg);
                            jp.close($topIndex);//关闭dialog

                        }else{
                            jp.error(data.msg);
                        }
                    })
                },
                errorContainer: "#messageBox",
                errorPlacement: function(error, element) {
                    $("#messageBox").text("输入有误，请先更正。");
                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
                        error.appendTo(element.parent().parent());
                    } else {
                        error.insertAfter(element);
                    }
                }
            });
            $('#date').datetimepicker({
                format: "YYYY-MM-DD HH:00"



            });
            $('#deliveryTime').datetimepicker({
                format: "YYYY-MM-DD HH:00"


            });
            $('#arrivalTime').datetimepicker({
                format: "YYYY-MM-DD HH:00"
            });
            $('#stowageDate').datetimepicker({
                format: "YYYY-MM-DD HH:00"
            });
            $('#presentTime').datetimepicker({
                format: "YYYY-MM-DD HH:00"
            });
        });

        function addRow(list, idx, tpl, row){
            $(list).append(Mustache.render(tpl, {
                idx: idx, delBtn: true, row: row
            }));
            $(list+idx).find("select").each(function(){
                $(this).val($(this).attr("data-value"));
            });
            $(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
                var ss = $(this).attr("data-value").split(',');
                for (var i=0; i<ss.length; i++){
                    if($(this).val() == ss[i]){
                        $(this).attr("checked","checked");
                    }
                }
            });
            $(list+idx).find(".form_datetime").each(function(){
                $(this).datetimepicker({
                    format: "YYYY-MM-DD HH:00"
                });
            });
        }
        function delRow(obj, prefix){
            var id = $(prefix+"_id");
            var delFlag = $(prefix+"_delFlag");
            if (id.val() == ""){
                $(obj).parent().parent().remove();
            }else if(delFlag.val() == "0"){
                delFlag.val("1");
                $(obj).html("&divide;").attr("title", "撤销删除");
                $(obj).parent().parent().addClass("error");
            }else if(delFlag.val() == "1"){
                delFlag.val("0");
                $(obj).html("&times;").attr("title", "删除");
                $(obj).parent().parent().removeClass("error");
            }
        }
        function tt(id,idx) {
            $.ajax({
                url:'${ctx}/infor/goods/getById?i='+id,
                success:function (data) {
                    $("#informationsList"+idx+"_coding").val(data.code) ;
                    $("#informationsList"+idx+"_specification").val(data.specifications) ;
                    $("#informationsList"+idx+"_type").val(data.type.name) ;
                    $("#informationsList"+idx+"_weight").val(data.grossWeight) ;
                    $("#informationsList"+idx+"_volume").val(data.volume) ;
                    $("#informationsList"+idx+"_packing").val(data.packing) ;
                    $("#informationsList"+idx+"_gross").val("") ;

                }


            })

        }
        function tt1(id,idx) {
            $.ajax({
                url:'${ctx}/infor/goods/getById?i='+id,
                success:function (data) {
                    $("#informationsList"+idx+"_goods").val(data.name) ;
                    $("#informationsList"+idx+"_goods0").val(data.id);
                    $("#informationsList"+idx+"_specification").val(data.specifications) ;
                    $("#informationsList"+idx+"_type").val(data.type.name) ;
                    $("#informationsList"+idx+"_weight").val(data.grossWeight) ;
                    $("#informationsList"+idx+"_volume").val(data.volume) ;
                    $("#informationsList"+idx+"_packing").val(data.packing) ;
                    $("#informationsList"+idx+"_gross").val("") ;

                }


            })

        }
        function se1(evt,id,idx) {
            ChangeCoords2(id); //控制查询结果div坐标

            var k = window.event ? evt.keyCode : evt.which;
            //输入框的id为txt_search，这里监听输入框的keyup事件
            //不为空 && 不为上箭头或下箭头或回车
            if ($("#"+id).val() != "" &&  k== 13 ) {
                $.ajax({
                    type: 'post',
                    async: true, //同步执行，不然会有问题
                    dataType: "json",
                    url: "${ctx}/infor/goods/getGoodsByCode?code="+$("#"+id).val(),   //提交的页面/方法
                    error: function (msg) {//请求失败处理函数
                        alert("数据加载失败");
                    },
                    success: function (data) { //请求成功后处理函数。
						/*  var objData = eval("(" + data.userName + ")");   */
                        console.log(data);
                        if (data.length > 0) {
                            var layer = "";
                            layer = "<table id='aa2'>";
                            $.each(data, function (idx, item) {
                                layer += "<tr class='line2' id='"+item.id+"'><td class='std2'>" + item.code+ "</td></tr>";
                            });
                            layer += "</table>";

                            //将结果添加到div中
                            $("#searchresult2").empty();
                            $("#searchresult2").append(layer);
                            $(".line1:first").addClass("hover");
                            $("#searchresult2").css("display", "");
                            //鼠标移动事件

                            $(".line2").hover(function () {
                                $(".line2").removeClass("hover");
                                $(this).addClass("hover");
                            }, function () {
                                $(this).removeClass("hover");
                                //$("#searchresult").css("display", "none");
                            });
                            //鼠标点击事件
                            $(".line2").click(function () {
                                $("#"+id).val($(this).text());
                                tt1($(this).attr("id"),idx);
                                $("#searchresult2").css("display", "none");
                            });
                        } else {
                            $("#searchresult2").empty();
                            $("#searchresult2").css("display", "none");
                        }
                    }
                });
            }
            else if (k == 38) {//上箭头
                $('#aa2 tr.hover').prev().addClass("hover");
                $('#aa2 tr.hover').next().removeClass("hover");
                $("#"+id).val($('#aa tr.hover').text());
            }
            else if (k == 40) {//下箭头
                $('#aa2 tr.hover').next().addClass("hover");
                $('#aa2 tr.hover').prev().removeClass("hover");
                $("#"+id).val($('#aa tr.hover').text());
            }
            else {
                $("#searchresult2").empty();
                $("#searchresult2").css("display", "none");
            }
        }
        $("#searchresult2").bind("mouseleave", function () {
            $("#searchresult2").empty();
            $("#searchresult2").css("display", "none");
        });
        function se0(evt,id,idx) {
            ChangeCoords1(id); //控制查询结果div坐标

            var k = window.event ? evt.keyCode : evt.which;
            //输入框的id为txt_search，这里监听输入框的keyup事件
            //不为空 && 不为上箭头或下箭头或回车
            if ($("#"+id).val() != "" &&  k == 13) {
                $.ajax({
                    type: 'post',
                    async: true, //同步执行，不然会有问题
                    dataType: "json",
                    url: "${ctx}/infor/goods/getGoodsByName?name="+$("#"+id).val(),   //提交的页面/方法
                    error: function (msg) {//请求失败处理函数
                        alert("数据加载失败");
                    },
                    success: function (data) { //请求成功后处理函数。
						/*  var objData = eval("(" + data.userName + ")");   */
                        console.log(data);
                        if (data.length > 0) {
                            var layer = "";
                            layer = "<table id='aa'>";
                            $.each(data, function (idx, item) {
                                layer += "<tr class='line1' id='"+item.id+"'><td class='std1'>" + item.name+ "</td></tr>";
                            });
                            layer += "</table>";

                            //将结果添加到div中
                            $("#searchresult1").empty();
                            $("#searchresult1").append(layer);
                            $(".line1:first").addClass("hover");
                            $("#searchresult1").css("display", "");
                            //鼠标移动事件

                            $(".line1").hover(function () {
                                $(".line1").removeClass("hover");
                                $(this).addClass("hover");
                            }, function () {
                                $(this).removeClass("hover");
                                //$("#searchresult").css("display", "none");
                            });
                            //鼠标点击事件
                            $(".line1").click(function () {
                                $("#"+id).val($(this).text());
                                $("#"+id+"0").val($(this).attr("id"));
                                tt($(this).attr("id"),idx);
                                $("#searchresult1").css("display", "none");
                            });
                        } else {
                            $("#searchresult1").empty();
                            $("#searchresult1").css("display", "none");
                        }
                    }
                });
            }
            else if (k == 38) {//上箭头
                $('#aa tr.hover').prev().addClass("hover");
                $('#aa tr.hover').next().removeClass("hover");
                $("#"+id).val($('#aa tr.hover').text());
            }
            else if (k == 40) {//下箭头
                $('#aa tr.hover').next().addClass("hover");
                $('#aa tr.hover').prev().removeClass("hover");
                $("#"+id).val($('#aa tr.hover').text());
            }
            else {
                $("#searchresult1").empty();
                $("#searchresult1").css("display", "none");
            }
        }
        $("#searchresult1").bind("mouseleave", function () {
            $("#searchresult1").empty();
            $("#searchresult1").css("display", "none");
        });

        function se(evt) {
            ChangeCoords(); //控制查询结果div坐标
            var k = window.event ? evt.keyCode : evt.which;
            //输入框的id为txt_search，这里监听输入框的keyup事件
            //不为空 && 不为上箭头或下箭头或回车
            if ($("#site").val() != ""  && k == 13) {
                $.ajax({
                    type: 'post',
                    async: true, //同步执行，不然会有问题
                    dataType: "json",
                    url: "${ctx}/infor/lnCustomers/getLnCustomersByName?name="+$("#site").val()+"&pro=${fns:getUseroffice()}",   //提交的页面/方法
                    error: function (msg) {//请求失败处理函数
                        alert("数据加载失败");
                    },
                    success: function (data) { //请求成功后处理函数。
						/*  var objData = eval("(" + data.userName + ")");   */
                        console.log(data);
                        if (data.length > 0) {
                            var layer = "";
                            layer = "<table id='aa'>";
                            $.each(data, function (idx, item) {
                                layer += "<tr class='line' id='"+item.id+"'><td class='std'>" + item.address+ "</td></tr>";
                            });
                            layer += "</table>";

                            //将结果添加到div中
                            $("#searchresult").empty();
                            $("#searchresult").append(layer);
                            $(".line:first").addClass("hover");
                            $("#searchresult").css("display", "");
                            //鼠标移动事件

                            $(".line").hover(function () {
                                $(".line").removeClass("hover");
                                $(this).addClass("hover");
                            }, function () {
                                $(this).removeClass("hover");
                                //$("#searchresult").css("display", "none");
                            });
                            //鼠标点击事件
                            $(".line").click(function () {
                                $("#site").val($(this).text());
                                tc($(this).attr("id"));
                                $("#searchresult").css("display", "none");
                            });
                        } else {
                            $("#searchresult").empty();
                            $("#searchresult").css("display", "none");
                        }
                    }
                });
            }
            else if (k == 38) {//上箭头
                $('#aa tr.hover').prev().addClass("hover");
                $('#aa tr.hover').next().removeClass("hover");
                $('#site').val($('#aa tr.hover').text());
            }
            else if (k == 40) {//下箭头
                $('#aa tr.hover').next().addClass("hover");
                $('#aa tr.hover').prev().removeClass("hover");
                $('#site').val($('#aa tr.hover').text());
            }

            else {
                $("#searchresult").empty();
                $("#searchresult").css("display", "none");
            }
        };
        $("#searchresult").bind("mouseleave", function () {
            $("#searchresult").empty();
            $("#searchresult").css("display", "none");
        });
        function addLn() {
            jp.openDialog('新增下游客户', "${ctx}/infor/lnCustomers/form2",'1200px', '800px', $('#carrierTable'));

        }
        function tc(id) {
            url='${ctx}/infor/lnCustomers/det?i='+id
            $.ajax({
                url:url,
                success:function (data) {
                    $("#unitConfirmor").val(data.person);
                    $("#phone").val(data.phone);
                    $("#arriveProvince").val(data.province);
                    $("#arriveCity").val(data.city);
                    $("#arrive").val(data.arrive.id);
                    $("#arriveName").val(data.arrive.name);
                    $("#khyq").val(data.needs);
                    $("#distance").val(data.mileage);
                    $("#contractDistance").val(data.mileage);
                    $("#transitLines").val(data.line);
                    $("#unitName").val(data.lnCustomers.company);
                },
                error:function (data) {
                    alert("失败了");

                }
            })

        }

        function ChangeCoords() {
            //    var left = $("#txt_search")[0].offsetLeft; //获取距离最左端的距离，像素，整型
            //    var top = $("#txt_search")[0].offsetTop + 26; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            var left = $("#site").position().left; //获取距离最左端的距离，像素，整型
            var top = $("#site").position().top + 32; ; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            $("#searchresult").css("left", left + "px"); //重新定义CSS属性
            $("#searchresult").css("top", top + "px"); //同上
        }
        function ChangeCoords1(id) {
            //    var left = $("#txt_search")[0].offsetLeft; //获取距离最左端的距离，像素，整型
            //    var top = $("#txt_search")[0].offsetTop + 26; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            var left = $("#"+id).position().left; //获取距离最左端的距离，像素，整型
            var top = $("#"+id).position().top + 30; ; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            $("#searchresult1").css("left", left + "px"); //重新定义CSS属性
            $("#searchresult1").css("top", top + "px"); //同上
        }
        function ChangeCoords2(id) {
            //    var left = $("#txt_search")[0].offsetLeft; //获取距离最左端的距离，像素，整型
            //    var top = $("#txt_search")[0].offsetTop + 26; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            var left = $("#"+id).position().left; //获取距离最左端的距离，像素，整型
            var top = $("#"+id).position().top + 30; ; //获取距离最顶端的距离，像素，整型（20为搜索输入框的高度）
            $("#searchresult2").css("left", left + "px"); //重新定义CSS属性
            $("#searchresult2").css("top", top + "px"); //同上
        }
        function js(val,idx) {
            if(val==""){
                val="0";
            }
            var a=parseInt(val);
            var id=$("#informationsList"+idx+"_goods0").val();
            $.ajax({
                url:'${ctx}/infor/goods/getById?i='+id,
                success:function (data) {
                    var w=parseFloat(data.grossWeight);
                    var v=parseFloat(data.volume);
                    $("#informationsList"+idx+"_weight").val(parseFloat((w*a).toFixed(5))) ;
                    $("#informationsList"+idx+"_volume").val(parseFloat((v*a).toFixed(5))) ;
                }
            })

        }
	</script>
</head>
<body class="bg-white">
<form:form id="inputForm" modelAttribute="planning" action="${ctx}/tms/planning/save" method="post" class="form-horizontal">
	<form:hidden path="id"/>
	<sys:message content="${message}"/>
	<ul class="nav nav-tabs">
		<li class="active"><a data-toggle="tab" href="#tab-01" aria-expanded="true">订单详情</a>
		</li>
		<li class=""><a data-toggle="tab" href="#tab-02" aria-expanded="true">服务信息</a>
		</li>
	</ul>
	<div class="tab-content">
		<div id="tab-01" class="tab-pane fade in  active">

			<div style="height: 20px"></div>
			<input type="button" onclick="addLn()" class="btn-success" value="新增下游客户"/>
			<div style="height: 20px"></div>
			<input type="hidden" id="pro" value="${planning.projectName}"/>
			<input type="hidden" id="mode" value="${planning.clearingMode}"/>
			<input type="hidden" id="ty" value="${planning.clearingType}"/>
			<input type="hidden" id="wid" value="${planning.width}"/>
			<table class="table table-bordered">
				<tbody>
				<tr>
					<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>装运单号：</label></td>
					<td class="width-23">
						<form:input path="shipmentNumbers" htmlEscape="false"    class="form-control required"/>
					</td>

					<td class="width-10 active"><label class="pull-right">订单类型：</label></td>
					<td class="width-23">
						<form:select path="type" class="form-control ">
							<form:options items="${fns:getDictList('orderType')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</td>
					<td class="width-10 active"><label class="pull-right">作业类型：</label></td>
					<td class="width-23">
						<form:select path="workType" class="form-control ">
							<form:options items="${fns:getDictList('workType')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</td>

				</tr>
				<tr>
					<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>  收货详细地址：</label></td>
					<td class="width-90" colspan="5">
						<input id="site" name="site" onkeyup="se(event)" autocomplete="off" htmlEscape="false" value="${planning.site}"   class="form-control required"/>
						<div id="searchresult" style="display: none;"></div>
							<%--<form:input path="site" htmlEscape="false"    class="form-control "/>--%>
					</td>
				</tr>
				<tr>

					<td class="width-10 active"><label class="pull-right">到站地城市：</label></td>
					<td class="width-23">
						<input id="arriveProvince" name="arriveProvince" htmlEscape="false" value="${planning.arriveProvince}"   type="hidden"/>
						<form:input path="arriveCity" htmlEscape="false"     class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">结算地：</label></td>
					<td class="width-23">

						<input type="text" id="arriveName" name="arrive.name" value="${planning.arrive.name}" class="form-control " >
						<input type="hidden" id="arrive" name="arrive.id" value="${planning.arrive.id}">
					</td>
					<td class="width-10 active"><label class="pull-right">运输线路：</label></td>
					<td class="width-23">
						<form:input path="transitLines" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>

					<td class="width-10 active"><label class="pull-right">收货单位名称：</label></td>
					<td class="width-23">
						<form:input path="unitName" htmlEscape="false"    class="form-control "/>

					</td>
					<td class="width-10 active"><label class="pull-right">收货单位确认人：</label></td>
					<td class="width-23">
						<form:input path="unitConfirmor" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">确认人电话：</label></td>
					<td class="width-23">
						<form:input path="phone" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>

				<tr>

					<td class="width-10 active"><label class="pull-right">合同里程：</label></td>
					<td class="width-23">
						<form:input path="distance" htmlEscape="false"    class="form-control "/>
					</td>

					<td  class="width-33 active"><label class="pull-right"><span style="color: red">*</span>起运地：</label></td>
					<td  class="width-33 active">
						<sys:gridselect    url="${ctx}/infor/start/data" id="contractDistance" name="contractDistance.id" value="${planning.contractDistance.id}" labelName="contractDistance.name" labelValue="${planning.contractDistance.name}"
										   title="选择起运地" cssClass="form-control required" fieldLabels="名称" fieldKeys="name" searchLabels="名称" searchKeys="name"  ></sys:gridselect>
					</td>
					<td class="width-10 active"><label class="pull-right">下单日期：</label></td>
					<td class="width-23">

						<div class='input-group form_datetime' id='date'>
							<input type='text'  name="date" class="form-control "  value="<fmt:formatDate value="${planning.date}" pattern="yyyy-MM-dd HH:00"/>"/>
							<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
						</div>

					</td>
				</tr>
				<tr>
					<td class="width-10 active"><label class="pull-right">客户特殊要求：</label></td>
					<td class="width-90" colspan="5">
						<form:input path="khyq"  htmlEscape="false"    class="form-control "/>
					</td></tr>
				</tbody></table>
			<div class="tabs-container">
				<ul class="nav nav-tabs">
					<li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">物料信息：</a>
					</li>
				</ul>
				<div class="tab-content">
					<div id="tab-1" class="tab-pane fade in  active">
						<a class="btn btn-white btn-sm" onclick="addRow('#informationsList', informationsRowIdx, informationsTpl);informationsRowIdx = informationsRowIdx + 1;" title="新增"><i class="fa fa-plus"></i> 新增</a>
						<table class="table table-striped table-bordered table-condensed">
							<thead>
							<tr>
								<th class="hide"></th>
								<th width="10%"><span style="color: red">*</span>提货单号</th>
								<th width="12%"><span style="color: red">*</span>物料编码</th>
								<th width="23%"><span style="color: red">*</span>物料名称</th>
								<th width="8%">物料规格</th>
								<th width="5%">物料类型</th>
								<th width="4%">单位</th>
								<th width="5%"><span style="color: red">*</span>计划量</th>
								<th width="5%">毛重(吨)</th>
								<th width="5%">体积(M3)</th>
								<th width="14%"><span style="color: red">*</span>提货仓库</th>
								<th width="2%">&nbsp;</th>
							</tr>
							</thead>
							<tbody id="informationsList">
							</tbody>
						</table>
						<script type="text/template" id="informationsTpl">//<!--
				<tr id="informationsList{{idx}}">
					<td class="hide">
						<input id="informationsList{{idx}}_id" name="informationsList[{{idx}}].id" type="hidden" value="{{row.id}}"/>
						<input id="informationsList{{idx}}_delFlag" name="informationsList[{{idx}}].delFlag" type="hidden" value="0"/>
											<input id="informationsList{{idx}}_idx" name="informationsList[{{idx}}].idx" type="hidden" value="{{idx}}"    class="form-control "/>

					</td>


					<td>
						<input id="informationsList{{idx}}_number" name="informationsList[{{idx}}].number" type="text" value="{{row.number}}"    class="form-control "/>
					</td>
                    <td>
						<input id="informationsList{{idx}}_coding" name="informationsList[{{idx}}].coding" type="text" value="{{row.coding}}" onkeyup="se1(event,this.id,'{{idx}}')"    class="form-control required"/>
					<div id="searchresult2" style="display: none;"></div>

					</td>

					<td>
					<input id="informationsList{{idx}}_goods" name="informationsList[{{idx}}].goods.name" type="text" value="{{row.goods.name}}" onkeyup="se0(event,this.id,'{{idx}}')"   class="form-control " />
                    <input  id="informationsList{{idx}}_goods0" name="informationsList[{{idx}}].goods.id" type="hidden" value="{{row.goods.id}}"    class="form-control " />

                    <div id="searchresult1" style="display: none;"></div>
					<%--<sys:gridselect url="${ctx}/infor/goods/data" id="informationsList{{idx}}_goods" name="informationsList[{{idx}}].goods.id" value="{{row.goods.id}}" labelName="informationsList{{idx}}.goods.name" labelValue="{{row.goods.name}}"--%>
							 <%--title="选择物料名称" cssClass="form-control  " fieldLabels="名称" fieldKeys="name" searchLabels="名称" searchKeys="name" ></sys:gridselect>--%>
					</td>





					<td>
						<input id="informationsList{{idx}}_specification" name="informationsList[{{idx}}].specification" type="text" value="{{row.specification}}"    class="form-control "/>
					</td>


					<td>
						<input id="informationsList{{idx}}_type" name="informationsList[{{idx}}].type" type="text" value="{{row.type}}"    class="form-control "/>
					</td>
<td>
						<input id="informationsList{{idx}}_packing" name="informationsList[{{idx}}].packing" type="text" value="{{row.packing}}"    class="form-control "/>
					</td>

					<td>
						<input id="informationsList{{idx}}_gross" name="informationsList[{{idx}}].gross" type="text" value="{{row.gross}}"   onblur="js(this.value,'{{idx}}')"   class="form-control required"/>
					</td>


					<td>
						<input id="informationsList{{idx}}_weight" name="informationsList[{{idx}}].weight" type="text" value="{{row.weight}}"    class="form-control "/>
					</td>


					<td>
						<input id="informationsList{{idx}}_volume" name="informationsList[{{idx}}].volume" type="text" value="{{row.volume}}"    class="form-control "/>
					</td>


					<td>
					<sys:gridselect    url="${ctx}/infor/takeAddress/data" id="informationsList{{idx}}_depot" name="informationsList[{{idx}}].depot.id" value="{{row.depot.id}}" labelName="informationsList[{{idx}}].depot.store" labelValue="{{row.depot.store}}"
							 title="选择仓库" cssClass="form-control required" fieldLabels="仓库" fieldKeys="store" searchLabels="仓库" searchKeys="store"  ></sys:gridselect>
						<%--<input id="informationsList{{idx}}_depot" name="informationsList[{{idx}}].depot" type="text" value="{{row.depot}}"    class="form-control "/>--%>
					</td>

					<td class="text-center" width="10">
						{{#delBtn}}<span class="close" onclick="delRow(this, '#informationsList{{idx}}')" title="删除">&times;</span>{{/delBtn}}
					</td>
				</tr>//-->
						</script>
						<script type="text/javascript">
                            var informationsRowIdx = 0, informationsTpl = $("#informationsTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
                            $(document).ready(function() {
                                var data = ${fns:toJson(planning.informationsList)};
                                for (var i=0; i<data.length; i++){
                                    addRow('#informationsList', informationsRowIdx, informationsTpl, data[i]);
                                    informationsRowIdx = informationsRowIdx + 1;
                                }
                            });
						</script>
					</div>
				</div>
			</div>
		</div>
		<div id="tab-02" class="tab-pane fade">

			<table class="table table-bordered"><tbody>
			<tr>
				<td class="width-10 active"><label class="pull-right">委托单号：</label></td>
				<td class="width-23">
					<form:input path="entrustNumber" readonly="true" htmlEscape="false"    class="form-control "/>
				</td>
				<td class="width-10 active"><label class="pull-right">项目名称：</label></td>
				<td class="width-23">
					<input <c:if test="${fns:getUseroffice()!='总部'}">readonly="readonly"</c:if> name="projectName" htmlEscape="false" value="${planning.projectName}"   class="form-control "/>
				</td>
				<td class="width-10 active"><label class="pull-right">委托单状态：</label></td>
				<td class="width-23">
					<input name="status" htmlEscape="false" value="${planning.status}"  readonly="readonly"   class="form-control "/>
						<%--<input name="planStatus" htmlEscape="false" value="${transportPlanning.planStatus}" type="hidden"   class="form-control "/>--%>

				</td>
			</tr>
			<tr>
				<td class="width-10 active"><label class="pull-right">运输方式：</label></td>
				<td class="width-23">
					<form:select path="transportMode" class="form-control ">
						<form:options items="${fns:getDictList('transport_mode')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</td>
				<td class="width-10 active"><label class="pull-right">结算方式：</label></td>
				<td class="width-23">
					<select id="clearingMode" class="form-control" name="clearingMode">

					</select>
						<%--<form:input path="clearingMode" htmlEscape="false"    class="form-control "/>--%>

				</td>
				<td class="width-10 active"><label class="pull-right">结算类型：</label></td>
				<td class="width-23">
					<select id="clearingType" class="form-control" name="clearingType">

					</select>
						<%--<form:input path="clearingType" htmlEscape="false"    class="form-control "/>--%>
				</td>
			</tr>
			<tr>

				<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>结算吨位区间：</label></td>
				<td class="width-23">
					<input id="contractDistance" value="${planning.contractDistance}" type="hidden" name="contractDistance" htmlEscape="false"    class="form-control "/>
					<select id="width" name="width"  class="form-control ">
					</select>
				</td>
				<td class="width-10 active"><label class="pull-right"><span style="color: red">*</span>要求发货时间：</label></td>
				<td class="width-23">

					<div class='input-group form_datetime' id='deliveryTime'>
						<input type='text'  name="deliveryTime" class="form-control required"  value="<fmt:formatDate value="${planning.deliveryTime}" pattern="yyyy-MM-dd HH:00"/>"/>
						<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
					</div>

				</td>
				<td class="width-10 active"><label class="pull-right">要求到货时间：</label></td>
				<td class="width-23">
					<p class="input-group">
					<div class='input-group form_datetime' id='arrivalTime'>
						<input type='text'  name="arrivalTime" class="form-control "  value="<fmt:formatDate value="${planning.arrivalTime}" pattern="yyyy-MM-dd HH:00"/>"/>
						<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
					</div>
					</p>
				</td>

			</tr>
			<tr>
				<td class="width-10 active"><label class="pull-right">备注信息：</label></td>
				<td class="width-90" colspan="5">
					<form:input path="remarks"  htmlEscape="false"    class="form-control "/>
				</td></tr>
			</tbody></table>
			<div style="height: 60px;"></div>
			<table class="table table-bordered" <c:if test="${list==null}">hidden="hidden"</c:if>>
				<tr>
					<th>物料类别</th>
					<th>计划量</th>
					<th>毛重</th>
					<th>体积</th>
					<th>提货仓库</th>
				</tr>
				<c:forEach items="${list}" var="map">
					<tr>
						<td>${map.type}</td>
						<td>${map.gross}</td>
						<td>${map.weight}</td>
						<td>${map.volume}</td>
						<td>${map.depot}</td>
					</tr>
				</c:forEach>
			</table>
		</div>
	</div>

</form:form>
</body>
</html>